package com.dong.designPattern.strategy;

import com.dong.designPattern.strategy.abs.TravelStrategy;

/**
 * 环境类
 */
public class PersonContext {

    // 拥有一个出行策略引用
    private TravelStrategy strategy;

    public PersonContext(TravelStrategy strategy) {
        this.strategy = strategy;
    }

    public void travel(){
        strategy.travelWay();;
    }

    public TravelStrategy getStrategy() {
        return strategy;
    }

    public void setStrategy(TravelStrategy strategy) {
        this.strategy = strategy;
    }
}
